//
//  GlobalService.h
//  upnpxdemo
//
//  Created by 赵帅 on 13-9-12.
//  Copyright (c) 2013年 wiimu.inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "serviceConfirmDownloadUpdate.h"
#import "serviceGetUpdateStatus.h"
#import "serviceConfirmUpdate.h"
#import "serviceGetWifiList.h"
#import "serviceGetDeviceInfo.h"
#import "serviceGetCurrentConnectedDevice.h"
#import "serviceConnectToWifi.h"
#import "serviceGetWifiConnectStatus.h"
#import "serviceGetPlayerStatus.h"
#import "servicePlayControl.h"
#import "serviceChangeVolume.h"
#import "servicePlaySeek.h"
#import "serviceResetDevice.h"
#import "serviceRebootDevice.h"
#import "serviceBeginCheckUpdate.h"
#import "serviceSetSSID.h"
#import "serviceVolumeMute.h"
#import "serviceGetWISAddress.h"
#import "serviceGetUSBMusicList.h"
#import "serviceGetUSBMusicInfo.h"
#import "servicePlayUSBMusic.h"
#import "serviceAddAudioToGroup.h"
#import "servicePlayListDemo.h"
#import "serviceSetPlayMode.h"
#import "serviceSetNewDownUri.h"
#import "serviceGetToDownList.h"
#import "serviceGetDownFinishedList.h"
#import "serviceGetDowningStatus.h"
#import "serviceSetDownCmd.h"
#import "serviceDelDownloadItem.h"
#import "serviceSetNewImDownUri.h"
#import "serviceMusicSyncDown.h"
#import "serviceSetPass.h"
#import "serviceGetGroupName.h"

#define HTTPSERVERR_PORT @"27567"

#warning 是我固定的测试UUID值
#define FIXED_UUID @"iosa801d9a41f52263d54aae802a384"
#define NOTIFICATION_DEV_STATE_CHANGE_GET @"dev_state_change_get"
#define NOTIFICATION_USERINFO_UPDATEDATA @"dev_state_change_get_update_data"



@interface GlobalService : NSObject


@property (retain) NSString * localIP;
@property (assign) int localPort;

@property (strong) NSString *curOperationDeviceUUID;


+ (GlobalService*) sharedInstance;

-(BOOL)checkIfIPChanged;
-(void)startHTTPServer;
-(void)stopHTTPServer;

-(void)removeService:(serviceInterfaceTemplate *)service;
-(void)removeHandler:(NSObject *)handler;
-(void)stopAllServices;

-(void)getWifiList:(id<serviceGetWifiListDelegate>)handler;
-(void)getDeviceInfo:(id<serviceGetDeviceInfoDelegate>)handler url:(NSString *)url;
-(void)getCurrentConnectedDevice:(id<serviceGetCurrentConnectedDeviceDelegate>)handler;
-(void)connectToWifi:(id<serviceConnectToWifiDelegate>)handler withSsid:(NSString *)ssid andAuth:(NSString *)auth andPass:(NSString *)password andChannel:(NSString *)channel andEncrypt:(NSString *)encrypt;
-(void)getWifiConnectStatus:(id<serviceGetWifiConnectStatusDelegate>)handler;
-(void)getPlayerStatus:(id<serviceGetPlayerStatusDelegate>)handler;
-(void)playControl:(id<servicePlayControlDelegate>)handler withCommand:(NSString *)command;
-(void)changeVolume:(id<serviceChangeVolumeDelegate>)handler withVol:(float)volume;
-(void)playSeek:(id<servicePlaySeekDelegate>)handler seekTo:(NSString *)pos;

-(void)resetDevice:(id<serviceResetDeviceDelegate>)handler;
-(void)rebootDevice:(id<serviceRebootDeviceDelegate>)handler;

-(void)beginCheckUpdate:(id<serviceBeginCheckUpdateDelegate>)handler;
-(void)confirmDownloadUpdate:(id<serviceConfirmDownloadUpdateDelegate>)handler;
-(void)getUpdateState:(id<serviceGetUpdateStatusDelegate>)handler;
-(void)confirmUpdate:(id<serviceConfirmUpdateDelegate>)handler;

-(void)setNewSSID:(id<serviceSetSSIDDelegate>)handler andNewSSID:(NSString *)newID;
-(void)setNewPass:(id<serviceSetPassDelegate>)handler andNewPass:(NSString *)pass;
-(void)setVolumeMute:(id<serviceVolumeMuteDelegate>)handler isMute:(BOOL)mute;

//wis
-(void)getWISAddress:(id<serviceGetWISAddressDelegate>)handler url:(NSString *)serverurl;

//music
-(void)getUSBMusicList:(id<serviceGetUSBMusicListDelegate>)handler;
-(void)getUSBMusicInfo:(id<serviceGetUSBMusicInfoDelegate>)handler fileIndex:(int)index;
-(void)playUSBMusic:(id<servicePlayUSBMusicDelegate>)handler fileIndex:(int)index;
-(void)setPlayMode:(id<serviceSetPlayModeDelegate>)handler playMode:(playmode)mode;

//multiroom
-(void)addAudioToGroup:(id<serviceAddAudioToGroupDelegate>)handler baseURL:(NSString *)url groupName:(NSString *)group;
-(void)getGroupName:(id<serviceGetGroupNameDelegate>)handler baseURL:(NSString *)url deviceName:(NSString *)name;
-(void)playListDemo:(id<servicePlayListDemoDelegate>)handler musicURL:(NSString *)url masterIP:(NSString *)masterIP groupName:(NSArray *)deviceIPs;

//download music
-(void)setNewDownUri:(id<serviceSetNewDownUriDelegate>)handler uri:(NSString *)uri;
-(void)setImNewDownUri:(id<serviceSetNewImDownUriDelegate>)handler uri:(NSString *)uri;
-(void)getDownloadingStatus:(id<serviceGetDowningStatusDelegate>)handler;
-(void)getToDownloadList:(id<serviceGetToDownListDelegate>)handler page:(int)page;
-(void)getDownFinishedList:(id<serviceGetDownFinishedListDelegate>)handler page:(int)page;
-(void)setDownloadCmd:(id<serviceSetDownCmdDelegate>)handler cmd:(NSString *)cmd;
-(void)deleteDownloadItem:(id<serviceDelDownloadItemDelegate>)handler listIndex:(int)listIndex controlFlag:(int)flag uri:(NSString *)uri;
-(void)setMusicSyncDownload:(id<serviceMusicSyncDownDelegate>)handler isEnable:(BOOL)enabled;
//保存uuid
-(void)convertToUserUUID;

@end
